//
//  MovieCell.m
//  MyMovie
//
//  Created by apple on 16/5/11.
//  Copyright © 2016年 ljp. All rights reserved.
//

#import "MovieCell.h"
#import "UIImageView+WebCache.h"
#import "StarView.h"

@interface MovieCell ()

@property (strong, nonatomic) IBOutlet UILabel *ratingLable;

@property (strong, nonatomic) IBOutlet UIImageView *movieImageView;
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@property (strong, nonatomic) IBOutlet StarView *ratingImage;
@property (strong, nonatomic) IBOutlet UILabel *yearLable;



@end

@implementation MovieCell

-(void)setMovie:(Movie *)movie {

    if (_movie == movie) {

        return;
    }
    _titleLabel.text = movie.title;
    _ratingLable.text = [NSString stringWithFormat:@"%.1f", movie.rating];

    _yearLable.text = [NSString stringWithFormat:@"年份:%@", movie.year];

    NSURL *url = [NSURL URLWithString:movie.images[@"medium"]];

    [_movieImageView sd_setImageWithURL:url];
    [_ratingImage changeRating:movie.rating];
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
